package com.newer.dao.sys.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.newer.pojo.sys.RoleResource;
import com.newer.pojo.sys.RoleResourceExample;
@Repository("roelResourceMapper")
public interface RoleResourceMapper {
    long countByExample(RoleResourceExample example);

    int deleteByExample(RoleResourceExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(RoleResource record);

    int insertSelective(RoleResource record);

    /**
     * 根据 roleId 查询权限
     * @param roleId
     * @return
     */
    List<RoleResource> selectAuthorByRoleId(Integer roleId);
    /**
     * 根据角色删除资源
     * @param roleId
     * @return
     */
    int deleteResourceByRoleId(Integer roleId);
    /**
     * 删除关联表
     */
    int deleteResourceByRoleIds(List<String> roleIds);
    /**
     * 授权
     * @param roleResource
     * @return
     */
    int insertRoleResource(List<RoleResource> roleResource);
    
    List<RoleResource> selectByExample(RoleResourceExample example);

    RoleResource selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") RoleResource record, @Param("example") RoleResourceExample example);

    int updateByExample(@Param("record") RoleResource record, @Param("example") RoleResourceExample example);

    int updateByPrimaryKeySelective(RoleResource record);

    int updateByPrimaryKey(RoleResource record);
}